/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jbrowser.services;

import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author suse
 */
public class LocalClassService implements ClassService {

    private static final Logger logger = Logger.getLogger(LocalClassService.class.getName());

    @Override
    public Class get(URI uri) {
        logger.log(Level.INFO, "get({0})", uri);
        if (uri.getScheme() == null || uri.getScheme().equals("jbrowser")) {
            try {
                return Class.forName(uri.getSchemeSpecificPart());
            } catch (Exception ex) {
                logger.log(Level.SEVERE, null, ex);
                throw new RuntimeException(ex);
            }
        } else {
            logger.log(Level.INFO, "Protocol not supported.");
            return null;
        }
    }

    @Override
    public String getName() {
        return "LocalClassService";
    }
}
